/**
 * @Author: Sagan
 * @Date: 2020/12/04 19:41
 */
package str

import (
	"strings"
	"unicode"
)

// 驼峰转换
func Uncamelize(str, sep string) string {
	buffer := strings.Builder{}
	for i, r := range str {
		if unicode.IsUpper(r) {
			if 0 != i {
				buffer.WriteString(sep)
			}
			r = unicode.ToLower(r)
		}
		buffer.WriteRune(r)
	}
	return buffer.String()
}
